# -*- coding: utf-8 -*-

import os

import xlutils as xlutils

N = 0


def file_name(file_dir):
    for root, dirs, files in os.walk(file_dir):
        return [root + '/' + file for file in files if ".xlsx" in file]


import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib.ticker as ticker
import numpy as np
import xlwt
import xlrd

plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号


def file_plot(index, values, label, mkdir_name):
    print(values)
    
    def x_fmt_func(x, pos=None):
        idx = np.clip(int(x + 0.5), 0, len(index) - 1)
        return index[idx]
    
    fig = plt.figure(figsize=(24, 8), dpi=80)
    ax = fig.add_subplot(1, 1, 1)
    ax.set_ylim(15, 26)
    ax.set_yticks(range(15, 27))
    # 横坐标描述
    plt.xlabel('日期')
    
    # 纵坐标描述
    plt.ylabel('时间')
    
    ax.plot(index, values, label=label, color='#FF6A6A', linewidth=2, linestyle="--")
    for a, b in zip(index, values):
        plt.text(a, b, str(b).replace(".", ":"), ha='center', va='bottom', fontsize=14, color='#555555')
    
    plt.legend()
    plt.savefig("./images/{}/{}.png".format(mkdir_name, label))


import pandas as pd


def file_load(file):
    file_name = str(file).split('.xlsx')[0]
    file_name = str(file_name).split('/')[-1]
    workbook = xlrd.open_workbook(file)
    workbooknew = xlutils.cop
    ws = workbooknew.get_sheet(0)

if __name__ == '__main__':
    files = file_name("./files")
    for file in files:
        data = file_load(file)
        # print(data)
    # print(files)
